# -*- coding: utf-8 -*-
# @Software :   PyCharm
# @File     :   adminx.py
# @Author   :   zhaolie
# @Contact  :   zhaolie1989@gmail.com
# @Time     :   2019/11/16 9:06 下午
# @Desc     :   None      

# here put the import lib
import xadmin
from xadmin import views

from .models import Banner


class BaseSetting:
    enable_themes = True
    use_bootswatch = True


class GlobalSettings:
    site_title = "后台管理系统"
    site_footer = 'zhaolie'
    menu_style = 'accordion'


class BannerAdmin:
    list_display = ["title", "image", "url", "index", "add_time"]
    search_fields = ["title", "image", "url", "index"]
    list_filter = ["title", "url", "index", "add_time"]

    def has_delete_permission(self, obj=None):
        return True


xadmin.site.register(Banner, BannerAdmin)
xadmin.site.register(views.BaseAdminView, BaseSetting)
xadmin.site.register(views.CommAdminView, GlobalSettings)
